#define SOL_ALL_SAFETIES_ON 1
#include <sol/sol.hpp>
#include "global.h"
#include "luaFont.h"
#include "GLFont.h"



namespace LuaHelp {
	sol::table open_luaFont(sol::this_state L) {
		sol::state_view lua(L);


		sol::table module=lua.script(R"(

local mod = {}

return mod;

		)");

		module.set_function("get_full_path", &lua::get_full_path);

		module.set_function("NewFont", sol::overload(
						[](void){
							auto font = CreateFTPixmapFont("FreeSans.ttf",30,1,1);
							return font;
						},
						[](const char* name, int size ){
							auto font = CreateFTPixmapFont(name,size,1,1);
							return font;
						}
				)
		);
		module["create_font"] = module["NewFont"];

		module.new_usertype<GLFONT>("GLFONT"

		);

		return module;
	}
}



extern "C" int luaopen_luaFont(lua_State* L)
{
	return sol::stack::call_lua(L, 1, LuaHelp::open_luaFont );
}

